import { SCENE_TYPE } from "./Core/AppDef";
import AppDelegate from "./AppDelegate";

const {ccclass, property} = cc._decorator;

@ccclass
export default class HallLayer extends cc.Component {
    @property(cc.EditBox)
    editbox:cc.EditBox = null;

    username = "";
    onLoad () {
        AppDelegate.init();
        this.editbox.node.on('editbox', this.callback, this);
        // this.editbox.node.on('editing-did-ended', this.callback, this);
        this.editbox.node.on('text-changed', this.callback, this);
    }

    callback(event) {
        this.username = event._string;;
    }

    onClickLogin(event) {
        AppDelegate.userModel.setMyName(this.username);
        cc.director.loadScene(SCENE_TYPE.ROOM);
    }


}
